package com.sinoglobal.wallet.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Message;
import com.sinoglobal.wallet.activity.W_HomeActivity.BalanceHandler;
import com.sinoglobal.wallet.app.SinoConstans;

/**
 * clf  提现成功后更改主页面的余额值。以及设置密码成功后发广播隐藏设置密码的布局
 */
public class W_ChangeBalanceReciver extends BroadcastReceiver{
    public BalanceHandler handler;

    public W_ChangeBalanceReciver(BalanceHandler handlerone) {
        this.handler = handlerone;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        if(intent.getAction().equals(SinoConstans.KEY_BalanceReceiver)){
        	
            String Balance = intent.getStringExtra("Balance");//提现成功传来的数据
            boolean hidePassWord = intent.getBooleanExtra("hidePassWord", false);//设置密码成功后传来的数据 
            String bankCardNum = intent.getStringExtra("bankCardNum");//设置密码成功后传来的数据 
            if(Balance!=null){
            Message msg = handler.obtainMessage(1);
            msg.obj = Balance;
            handler.sendMessage(msg);}
            if(hidePassWord){
            	Message msg = handler.obtainMessage(2);
            	handler.sendMessage(msg);}
            if(bankCardNum!=null){
            	Message msg = handler.obtainMessage(3);
            	msg.obj = bankCardNum;
            	handler.sendMessage(msg);}
        }

    }
}
